from django.http import HttpResponse
from django.http import JsonResponse
from django.core.serializers import serialize
import json
from auth_app.models import RbacUser


def index(request):
    return HttpResponse("Hello, world. You're at the index.")

def users(request):
    users = RbacUser.objects.all()
    user_data = serialize('json', users)  # 序列化 QuerySet 为 JSON 格式
    return JsonResponse(json.loads(user_data), safe=False)